import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import "@/style/reset.css";
import App from "./App.jsx";
import { userStore } from "./common/store/index.js";
import { getFingerprint } from "./common/utils/userUtils.js";
import { loadGetIp } from "./api/user.js";

const { getters, setters } = userStore();

createRoot(document.getElementById("root")).render(
  <StrictMode>
    <App />
  </StrictMode>
);

if (!getters.getIp()) {
  getFingerprint().then((fingerprint) => {
    loadGetIp({ ip: fingerprint });
    setters.setIp(fingerprint);
  });
}
